<?php


if($_GET['remove']==1) {
    remove_role( 'participant' );
}
//if(get_option('wp_sponsorpress_projets')) { $op = extract(get_option('wp_sponsorpress_projets')); }
//print_r($op);
//$options = get_option('wp_sponsorpress_projets');
//echo WPSPO_BASENAME;

//update_post_meta($options, "_wp_page_template", WPSPO_THEME_URL."wpspo-profil.php");
//echo '<a href="'.site_url( $_SERVER['REQUEST_URI'] ).'&remove=1">Supprimer les rôles ?</a>';

if($_POST['action'] == 'update') {

    update_option('wpspo_plugin_settings', $_POST["wpspo_plugin_settings"]);
    update_option('wpspo_emails_settings', $_POST["wpspo_emails_settings"]);
    update_option('wpspo_currency', $_POST["wpspo_currency"]);
    update_option('wpspo_currency_pos', $_POST["wpspo_currency_pos"]);
    update_option('wpspo_price_trim_zeros', $_POST["wpspo_price_trim_zeros"]);
    
    $options_saved = true;
    echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.', 'sponsorpress').'</strong></p></div>';

}

if(get_option('wpspo_plugin_settings')) { extract(get_option('wpspo_plugin_settings')); }
$paramWpspoSetting = get_option('wpspo_plugin_settings');
//print_r($paramWpspoSetting);
if(get_option('wpspo_emails_settings')) { extract(get_option('wpspo_emails_settings')); }
$paramWpspoEmailSetting = get_option('wpspo_emails_settings');


?>
<script type="text/javascript" charset="utf-8">
    
    jQuery(document).ready(function() {
        <?php for($i=1; $i<=12; $i++) { ?>
        jQuery('#slideMe<?php echo $i; ?>').hide();
        jQuery('#clickMe<?php echo $i; ?>').click(function() {
            jQuery('#slideMe<?php echo $i; ?>').slideToggle(400);
            return false;
        });
        <?php } ?>
    });


</script>
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
<?php
echo '**************** TEST ******************<br /><br />';
echo 'Content: '.WP_PLUGIN_URL.'/'.WPSPO_NAME_DIR.'/wpspo-themes/default/wpspo_email.html<br /><br />';
$content = file_get_contents(WP_PLUGIN_URL.'/'.WPSPO_NAME_DIR.'/wpspo-themes/default/wpspo_email.html');
if($content==false) {
    
    echo 'NO!<br /><br />';
} else {
    echo 'YES!<br /><br />';   
}
echo '************** FIN TEST ****************<br />';
?>
<div class="wrap">

    <!-- TABS OPTIONS -->
    <div id="icon-options-general" class="icon32"><br></div>
    <h2 class="nav-tab-wrapper">
                <a id="wpspo-menu-general" class="nav-tab nav-tab-active" href="#general" onfocus="this.blur();"><?php _e('General', 'sponsorpress'); ?></a>
                <a id="wpspo-menu-security" class="nav-tab" href="#security" onfocus="this.blur();"><?php _e('Security', 'sponsorpress'); ?></a>
                <a id="wpspo-menu-emails" class="nav-tab" href="#emails" onfocus="this.blur();"><?php _e('Emails', 'sponsorpress'); ?></a>
                <a id="wpspo-menu-payment" class="nav-tab" href="#payment" onfocus="this.blur();"><?php _e('Payment', 'sponsorpress'); ?></a>
                <a id="wpspo-menu-shortcodes" class="nav-tab" href="#shortcodes" onfocus="this.blur();"><?php _e('Shortcodes', 'sponsorpress'); ?></a>
     </h2>
       
    </div>
    <div>
    <div class="clear"/>
    <form method="post" action="" name="valide_settings">
               
        <?php wp_nonce_field( 'some-action-nonce' );
 
				/* Used to save closed metaboxes and their order */
				wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
				wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); 
        ?>
        <?php settings_fields('wpspo_plugin_settings'); ?>
         <div style="margin-left:25px;margin-top: 15px;">
             
             <!-- Onglet options Général -->
             <div class="wpspo-menu-general wpspo-menu-group">
                 <div id="wpspo-opt-general"  >
                     
                    <h3><?php _e('Challenges options', 'sponsorpress'); ?></h3> 
                    <table class="form-table">
                        <tbody>
                            <!-- CHOIX LIMIT DATE DEFIS -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Do not allow the dates of previous challenges:', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp">
                                    <input type= "text" name="wpspo_plugin_settings[limitdate]" class="regular-text code" style="width:3em" value="<?php if($paramWpspoSetting['limitdate']) { echo $paramWpspoSetting['limitdate']; } else { echo '2';} ?>"> (<?php _e('Expressed in days', 'sponsorpress'); ?>)
                                </td>
                            </tr>
                            <!-- CHOIX PROMESSE / DEFI -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Allow several promises for the same challenge?', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    <input type= "radio" name="wpspo_plugin_settings[promdefi]" value="1" <?php if($paramWpspoSetting['promdefi']==1) { echo ' checked'; } ?>>&nbsp;<?php _e('Yes', 'sponsorpress'); ?>&nbsp;&nbsp;&nbsp;<input type= "radio" name="wpspo_plugin_settings[promdefi]" value="0" <?php if(!$paramWpspoSetting['promdefi'] or $paramWpspoSetting['promdefi']==0) { echo ' checked'; } ?>>&nbsp;<?php _e('No', 'sponsorpress'); ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    
                    <h3><?php _e('Map options', 'sponsorpress'); ?></h3>
                    <table class="form-table">
                        <tbody>
                            <!-- CHOIX ACTIVATION MAPS DEFIS -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Enable maps for challenges?', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    <input type= "radio" name="wpspo_plugin_settings[affmaps]" value="1" <?php if($paramWpspoSetting['affmaps']==1) { echo ' checked'; } ?>>&nbsp;<?php _e('Yes', 'sponsorpress'); ?>&nbsp;&nbsp;&nbsp;<input type= "radio" name="wpspo_plugin_settings[affmaps]" value="0" <?php if(!$paramWpspoSetting['affmaps'] or $paramWpspoSetting['affmaps']==0) { echo ' checked'; } ?>>&nbsp;<?php _e('No', 'sponsorpress'); ?>
                                </td>
                            </tr>
                            <!-- CHOIX ACTIVATION MAPS GENERALE DEFIS -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Activate the global map of challenges?', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    <input type= "radio" name="wpspo_plugin_settings[affmapsdefis]" value="1" <?php if($paramWpspoSetting['affmapsdefis']==1) { echo ' checked'; } ?>>&nbsp;<?php _e('Yes', 'sponsorpress'); ?>&nbsp;&nbsp;&nbsp;<input type= "radio" name="wpspo_plugin_settings[affmapsdefis]" value="0" <?php if(!$paramWpspoSetting['affmapsdefis'] or $paramWpspoSetting['affmapsdefis']==0) { echo ' checked'; } ?>>&nbsp;<?php _e('No', 'sponsorpress'); ?>
                                </td>
                            </tr>
                            <!-- CHOIX DES TYPES DEFIS -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Type of challenges', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    <?php if($paramWpspoSetting['listtypedefi']=='') { $paramWpspoSetting['listtypedefi'] = 'Un particulier;Un groupe de jeunes;Une Colonie;Une Association'; } ?>
                                    <textarea name="wpspo_plugin_settings[listtypedefi]" rows="3" cols="55" /><?php echo $paramWpspoSetting['listtypedefi']; ?></textarea>
                                    <p class="description"><?php _e('Separate types by semicolons (default: <i>A particular;A group;A Colony;An Association</ i>)', 'sponsorpress'); ?></p>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    
                    <h3><?php _e('Generals conditions page', 'sponsorpress'); ?></h3>
                    <table class="form-table">
                        <tbody>
                            <!-- CHOIX DE LA PAGE DES CONDITIONS GENERALES -->
                            <tr valign="top">
                                 <p class="description"><?php _e('Please, select your page of generals conditions.','sponsorpress'); ?></p>
                            <select name="wpspo_plugin_settings[paylink]"> 
                             <option value=""><?php _e( 'Select page', 'sponsorpress' ); ?></option> 
                             <?php 
                              $wpspo_pages = get_pages(); 
                              foreach ( $wpspo_pages as $wpspo_page ) {
                                $addPage = '';
                                if($paramWpspoSetting['paylink']==get_page_link( $wpspo_page->ID )) { $addPage = ' selected'; }
                                $option = '<option value="' . get_page_link( $wpspo_page->ID ) . '" '.$addPage.' >';
                                $option .= $wpspo_page->post_title;
                                $option .= '</option>';
                                echo $option;
                              }
                             ?>
                    </select>
                        </tr>
                        </tbody>
                    </table>
                    
                    <h3><?php _e('Currency options', 'sponsorpress'); ?></h3>
                    <p class="description"><?php _e('The following options determine how the money will be posted on the site.','sponsorpress'); ?></p>
                    <table class="form-table">
                        <tbody>
                            <!-- CHOIX DE LA MONNAIE -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Currency', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    <select name="wpspo_currency">
                                        <?php
                                            $currency_code_options = get_wpspo_currencies();
                                            foreach ( $currency_code_options as $code => $name ) {
                                                if(get_option( 'wpspo_currency' )==$code) { $add='selected'; } else { $add=''; }
                                                echo '<option value="'.$code.'" '.$add.'>'.$name.' (' . get_wpspo_currency_symbol( $code ) . ')</option>';
                                            }
                                        ?>
                                    </select>
                                </td>
                            </tr>
                            <!-- Position monnaie -->
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Currency position', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    <select name="wpspo_currency_pos">
                                        <?php
                                            $currentyPos = array(
                                                    'left' => __('Left', 'sponsorpress'),
                                                    'right' => __('Right', 'sponsorpress'),
                                                    'left_space' => __('Left with space', 'sponsorpress'),
                                                    'right_space' => __('Right with space', 'sponsorpress')
                                                );
                                            foreach($currentyPos as $codePos=>$namePos) {
                                                if(get_option( 'wpspo_currency_pos' )==$codePos) { $addPos='selected'; } else { $addPos=''; }
                                                echo '<option value="'.$codePos.'" '.$addPos.'>'.$namePos.'</option>';
                                            }
                                        ?>
                                    </select>
                                </td>
                            </tr>
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    <?php _e('Zeros', 'sponsorpress'); ?>
                                </th>
                                <td class="forminp forminp-select">
                                    	<input name="wpspo_price_trim_zeros" id="wpspo_price_trim_zeros" type="checkbox" value="yes" <?php if(get_option( 'wpspo_price_trim_zeros' )=='yes') { echo 'checked="checked"'; } ?>> <?php _e('Delete the zeros after the decimal point. Ex:  $10.00 becomes $10', 'sponsorpress'); ?>
                                </td>
                            </tr>
                            <!-- 
                            <tr valign="top">
                                <th scope="row" class="titledesc">
                                    titre
                                </th>
                                <td class="forminp forminp-select">
                                    texte
                                </td>
                            </tr> -->

                        </tbody>
                    </table>
                    
                    
                    <p class="submit">
                        <a href="#security" id="submitbutton" OnClick="document.forms['valide_settings'].submit();this.blur();" name="Save" class="button-primary"><span> <?php _e('Save Options', 'sponsorpress'); ?> </span></a>
                    </p>
                </div> <!-- .postbox -->
            </div>
            
            <!-- Onglets options Sécurité -->
            <div class="wpspo-menu-security wpspo-menu-group" style="display:none;">
                <div id="wpspo-opt-security"  >
                <ul>
                    <!-- CHOIX VERROU FORMULAIRE CAPTCHA -->
                    <li><h3><?php _e('Enable Captcha on the forms?', 'sponsorpress'); ?></h3>
                        <input type= "radio" name="wpspo_plugin_settings[captcha]" value="1" <?php if($paramWpspoSetting['captcha']==1) { echo ' checked'; } ?>>&nbsp;<?php _e('Yes', 'sponsorpress'); ?>&nbsp;&nbsp;&nbsp;
                        <input type= "radio" name="wpspo_plugin_settings[captcha]" value="0" <?php if(!$paramWpspoSetting['captcha'] or $paramWpspoSetting['captcha']==0) { echo ' checked'; } ?>>&nbsp;<?php _e('No', 'sponsorpress'); ?>
                    </li>
                    <li> &nbsp;</li>
                    
                    <li><h3><?php _e('Enter keys', 'sponsorpress'); ?></h3>
                        <small><?php _e('The list of keys is available on', 'sponsorpress'); ?> <a href="https://www.google.com/recaptcha/admin/list" target="_blank" ><?php _e('this page', 'sponsorpress'); ?></a>.</small><br />
                        <?php _e('Public Key:', 'sponsorpress'); ?> <input type= "text" name="wpspo_plugin_settings[captchakeypu]" size="40" value="<?php echo $paramWpspoSetting['captchakeypu']; ?>" /><br />
                        <?php _e('Private Key:', 'sponsorpress'); ?> <input type= "text" name="wpspo_plugin_settings[captchakeypr]" size="40" value="<?php echo $paramWpspoSetting['captchakeypr']; ?>" />
                        
                    </li>
                    <li> &nbsp;</li>
                </ul>
                
                <ul>
                    <li> &nbsp;</li>
                    <li>
                        <a href="#security" id="submitbutton" OnClick="document.forms['valide_settings'].submit();this.blur();" name="Save" class="button-primary"><span> <?php _e('Save options', 'sponsorpress'); ?></span></a>
                    </li>
                </ul>
                </div> <!-- .postbox -->
            </div>

            <!-- Onglet options Emails -->
            <div class="wpspo-menu-emails wpspo-menu-group" style="display:none;">
                <div id="wpspo-opt-emails"  >
                <ul>
                    <!-- CHOIX ACTIVATION EMAIL NOUVEAU DEFIS -->
                    <li><h3><?php _e('Receive an e-mail for new challenges?', 'sponsorpress'); ?></h3>
                        <input type= "radio" name="wpspo_plugin_settings[emaildefi]" value="1" <?php if($paramWpspoSetting['emaildefi']==1) { echo ' checked'; } ?>>&nbsp;<?php _e('Yes', 'sponsorpress'); ?>&nbsp;&nbsp;&nbsp;
                        <input type= "radio" name="wpspo_plugin_settings[emaildefi]" value="0" <?php if($paramWpspoSetting['emaildefi']==0) { echo ' checked'; } ?>>&nbsp;<?php _e('No', 'sponsorpress'); ?>
                    </li>
                    <li> &nbsp;</li>

                    <!-- CHOIX ACTIVATION EMAIL MODIFICATION DEFIS -->
                    <li><h3><?php _e('Receive an email for changes challenge?', 'sponsorpress'); ?></h3>
                        <input type= "radio" name="wpspo_plugin_settings[emaildefimodif]" value="1" <?php if($paramWpspoSetting['emaildefimodif']==1) { echo ' checked'; } ?>>&nbsp;<?php _e('Yes', 'sponsorpress'); ?>&nbsp;&nbsp;&nbsp;
                        <input type= "radio" name="wpspo_plugin_settings[emaildefimodif]" value="0" <?php if(!$paramWpspoSetting['emaildefimodif'] or $paramWpspoSetting['emaildefimodif']==0) { echo ' checked'; } ?>>&nbsp;<?php _e('No', 'sponsorpress'); ?>
                    </li>
                    

                    <!-- CHOIX EMAIL FROM -->
                    <li><h3><?php _e('E-mail copy:', 'sponsorpress'); ?></h3>
                        <p><?php _e('Enter the e-mail for sending a copy.', 'sponsorpress'); ?></p>
                        <input type= "text" name="wpspo_plugin_settings[emailplugin]" class="regular-text code" size="40" value="<?php if(!$paramWpspoSetting['emailplugin']) { echo get_bloginfo('admin_email'); } else { echo $paramWpspoSetting['emailplugin']; } ?>" />
                    </li>
                    
                    <!-- CHOIX EMAIL REPLY TO -->
                    <li><h3><?php _e('Reply e-mail:', 'sponsorpress'); ?></h3>
                        <p><?php _e('Enter the reply e-mail.', 'sponsorpress'); ?></p>
                        <input type= "text" name="wpspo_plugin_settings[emailresponse]" class="regular-text code" size="40" value="<?php if(!$paramWpspoSetting['emailresponse']) { echo get_bloginfo('admin_email'); } else { echo $paramWpspoSetting['emailresponse']; } ?>" />
                    </li>
                    
                    <!-- EMAIL VALIDATION PROMESSE -->
                    <li><h3><?php _e('Email sending validations pledge:', 'sponsorpress'); ?></h3>
                        <p><?php _e('Enter the e-mail which will be sent notifications when a validated promise.', 'sponsorpress'); ?></p>
                        <input type= "text" name="wpspo_plugin_settings[email_valide_promesse]" class="regular-text code" size="40" value="<?php if(!$paramWpspoSetting['email_valide_promesse']) { echo get_bloginfo('admin_email'); } else { echo $paramWpspoSetting['email_valide_promesse']; } ?>" />
                    </li>
                    <li> &nbsp;</li>
                    
                    <!-- Upload Logo pour email -->
                    <li><h3><?php _e('Upload your logo:', 'sponsorpress'); ?></h3>
                        <input id="upload_logo" size="36" name="wpspo_emails_settings[logo]" value="<?php echo $paramWpspoEmailSetting['logo']; ?>" type="text" /> <a href="#" id="upload_logo_button" class="button" OnClick="this.blur();"><span> <?php _e('Select or Upload your logo', 'sponsorpress'); ?> </span></a>
                    </li>
                    
                    <li> &nbsp;</li>
                    <!-- TEst -->
                    <div class="postbox-container" style="width: 92%;">
                        <p><?php _e('Please enter the content of every email (Click to scroll):', 'sponsorpress'); ?></p>
                        <div class="metabox-holder">
                            <div class="meta-box-sortables">
                                
                                <!-- NOUVEAU DEFI -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe1" ><span><?php _e('Notification settings for a new challenge', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe1">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[emailtexte]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['emailtexte'])); ?></textarea></p>
                                    </div>
                                </div>
                                <!-- MODIFICATION DEFI -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe2"><span><?php _e('Notification Setting a challenge that has been modified', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe2">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[emailtextemodif]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['emailtextemodif'])); ?></textarea></p>
                                    </div>
                                </div>
                                <!-- NOTIFICATION POUR NOUVEAU PARTICIPANT -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe3"><span><?php _e('Notification settings for a new participant', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe3">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[email_txt_participate]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_participate'])); ?></textarea></p>
                                    </div>
                                </div>
                                <!-- NOTIFICATION POUR UNE PROMESSE ENREGISTREE -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe4"><span><?php _e('Notification settings for a pledge recorded', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe4">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[email_txt_promesse]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_promesse'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION POUR SPONSORISATION DEFI -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe5"><span><?php _e('Notification settings for a sponsoring of challenge', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe5">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[email_txt_challenge]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_challenge'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION POUR SPONSORISATION PARTICIPANT -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe6"><span><?php _e('Notification settings for a sponsoring of participant', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe6">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[email_txt_participant]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_participant'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION POUR INVITATION -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe7"><span><?php _e('Notification settings for a participant invitation', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe7">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br />
                        <textarea name="wpspo_emails_settings[email_txt_invite]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_invite'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION POUR PARTICIPANT SUITE A SON DON -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe8"><span><?php _e('Notification settings for a new pledge to user', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe8">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br /><textarea name="wpspo_emails_settings[email_txt_newpromesse]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_newpromesse'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                 <!-- NOTIFICATION POUR PARTICIPANT SUITE A SON DON TYPE 1 DON FIXE -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe9"><span><?php _e('Notification settings thanks for a new pledge', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe9">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br /><textarea name="wpspo_emails_settings[email_txt_thankspromesse]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_thankspromesse'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION DEFI FERME -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe10"><span><?php _e('Notification settings for a deleted pledge', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe10">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br /><textarea name="wpspo_emails_settings[email_txt_challenge_delete]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_challenge_delete'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION POUR DEFI CLOTURER -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe11"><span><?php _e('Notification settings for a fenced challenge', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe11">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br /><textarea name="wpspo_emails_settings[email_txt_challenge_close]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_challenge_close'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                <!-- NOTIFICATION POUR DEFI CLOTURER -->
                                <div class="postbox">
                                    <div class="handlediv" title="<?php _e('Click to scroll', 'sponsorpress'); ?>"><br /></div>
                                    <h3 class="hndle" id="clickMe12"><span><?php _e('Notification settings for finalize a pledge', 'sponsorpress'); ?></span></h3>
                                    <div class="inside" id="slideMe12">
                                        <p><a href="admin.php?page=sponsor-about#marqueurs"><?php _e('See the information on markers', 'sponsorpress'); ?></a><br /><br /><textarea name="wpspo_emails_settings[email_txt_finish_challenge]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_finish_challenge'])); ?></textarea></p>
                                    </div>
                                </div>
                                
                                
                            </div>
                        </div>
                    </div>
                    <div style="clear:both;"></div>         
                </ul>
                <ul>
                <li>  <h3><?php _e('Signature settings', 'sponsorpress'); ?></h3>
                <p><?php _e('Enter your e-mail signature (may contain markers).', 'sponsorpress'); ?></p>
                    <textarea name="wpspo_emails_settings[email_txt_signature]" rows="4" cols="85" /><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_signature'])); ?></textarea>
                </li>
                <li>  <h3><?php _e('Bottom settings', 'sponsorpress'); ?></h3>
                <p><?php _e('Enter your e-mail bottom (may contain markers).', 'sponsorpress'); ?></p>
                    <textarea name="wpspo_emails_settings[email_txt_bottom]" rows="4" cols="85" /><?php echo stripslashes(trim($paramWpspoEmailSetting['email_txt_bottom'])); ?></textarea>
                </li>
                    
                <ul>
                    <li> &nbsp;</li>
                </ul>
                <ul>
                    <li>
                        <a href="#emails" id="submitbutton" OnClick="document.forms['valide_settings'].submit();this.blur();" name="Save" class="button-primary"><span> <?php _e('Save options', 'sponsorpress'); ?></span></a>
                    </li>
                </ul>
                </div> <!-- .postbox -->
            </div>
    
            
            <!-- Onglet options Paiement -->
            <div class="wpspo-menu-payment wpspo-menu-group" style="display:none;">
                <div id="wpspo-opt-payment"  >
                <ul>
                <li><h3><?php _e( 'Choice of payment methods', 'sponsorpress' ); ?></h3>
                    <?php _e( 'If a page with different modalities exist, choose this page:', 'sponsorpress' ); ?>
                    <select name="wpspo_plugin_settings[paylink]"> 
                     <option value=""><?php _e( 'Select page', 'sponsorpress' ); ?></option> 
                     <?php 
                      $wpspo_pages = get_pages(); 
                      foreach ( $wpspo_pages as $wpspo_page ) {
                        $addPage = '';
                        if($paramWpspoSetting['paylink']==get_page_link( $wpspo_page->ID )) { $addPage = ' selected'; }
                        $option = '<option value="' . get_page_link( $wpspo_page->ID ) . '" '.$addPage.' >';
                        $option .= $wpspo_page->post_title;
                        $option .= '</option>';
                        echo $option;
                      }
                     ?>
                    </select>
                    
                    <!-- Paiement via Chèque -->
                    <br /><br />
                    <input type= "checkbox" name="wpspo_plugin_settings[paycheque]" value="1" <?php if($paramWpspoSetting['paycheque']==1) { echo ' checked'; } ?>> <b><?php _e( 'Authorize payment by check', 'sponsorpress' ); ?></b><br />
                    <!-- Fenetre déroulante -->
                    <div class="postbox-container" style="width: 48%;margin-left:3%">
                        <div class="metabox-holder">
                            <div class="meta-box-sortables">
                                <div class="postbox">
                                    <div class="handlediv" title="Cliquer pour dérouler"><br /></div>
                                    <h3 class="hndle" id="clickMe8" ><span><?php _e( 'Address', 'sponsorpress' ); ?></span></h3>
                                    <div class="inside" id="slideMe8">
                                        <p><?php _e( 'Enter here the address to send the check', 'sponsorpress' ); ?><br /><br />
                                            <textarea name="wpspo_plugin_settings[paychequeadress]" rows="8" cols="60"><?php echo stripslashes(trim($paramWpspoSetting['paychequeadress'])); ?></textarea></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="clear"></div>
                    <!-- FIN -- Fenetre déroulante -->
                   
                    <!-- Paiement via Virement -->
                    <br /><hr /><br />
                    <input type= "checkbox" name="wpspo_plugin_settings[payvir]" value="1" <?php if($paramWpspoSetting['payvir']==1) { echo ' checked'; } ?>> <b><?php _e( 'Authorize payment by bank transfer', 'sponsorpress' ); ?></b><br /><br />
                    <?php 
                    // TODO : ID pour plugin download
                        if($paramWpspoSetting['payvirfile']!='') {
                            $wpspo_filepath = $paramWpspoSetting['payvirfile'];
                            $wpspo_filepath = str_replace('\\', '/', $wpspo_filepath);
                            $wpspo_path_file = pathinfo($wpspo_filepath);
                            echo '<br /><strong>'.__( 'Current file:', 'sponsorpress' ).'</strong> <a href="'.$paramWpspoSetting['payvirfile'].'" target="_blank">'.$wpspo_path_file['basename'].'</a><br /><br />';
                        }
                        if($paramWpspoSetting['payvirfile']=='' && $paramWpspoSetting['payvir']==1) {
                            echo '<br /><div style="color:#990000;">'.__("You don't specified file for transfer", 'sponsorpress').'</div>';
                        }

                    ?>
                    <?php _e( 'Upload your file', 'sponsorpress' ); ?> <label for="upload_file"> <input id="upload_file" size="36" name="wpspo_plugin_settings[payvirfile]" value="<?php echo $paramWpspoSetting['payvirfile']; ?>" type="text" /> <input id="upload_image_button" value="<?php _e('Select your file', 'sponsorpress'); ?>" type="button" /> </label><br />
                    
                    <!-- Paiement via PayPal -->
                    <br /><hr /><br />
                    <input type= "checkbox" name="wpspo_plugin_settings[paypaypal]" value="1" <?php if($paramWpspoSetting['paypaypal']==1) { echo ' checked'; } ?>> <b><?php _e( 'Authorize payment by Paypal', 'sponsorpress' ); ?></b><br /><br />
                     <?php _e( 'Enter title:', 'sponsorpress' ); ?> <input type="text" name="wpspo_plugin_settings[paypaypal_title]" value="<?php echo ($paramWpspoSetting['paypaypal_title']); ?>"><br />
                     <?php _e( 'Enter email address:', 'sponsorpress' ); ?> <input type="text" name="wpspo_plugin_settings[paypaypal_email]" value="<?php echo ($paramWpspoSetting['paypaypal_email']); ?>"><br />
                     
                </li>
                </ul>
                
                <ul>
                    <li> &nbsp;</li>
                    <li>
                        <a href="#payment" id="submitbutton" OnClick="document.forms['valide_settings'].submit();this.blur();" name="Save" class="button-primary"><span> <?php _e('Save options', 'sponsorpress'); ?> </span></a>
                    </li>
                </ul>
                </div> <!-- .postbox -->
            </div>
            
            <!-- Onglet Shortcodes -->
            <div class="wpspo-menu-shortcodes wpspo-menu-group" style="display:none;">
                <div id="wpspo-opt-shortcodes"  >
                <ul>
                    <li>
                        <input type="text" size="40" value="do_shortcode('[wpspo_profil]')" /> <?php _e( 'Use this shorcode for display login link', 'sponsorpress' ); ?>
                    </li>
                </ul>
                <ul>
                    <li> &nbsp;</li>
                    <li>
                        <a href="#shortcodes" id="submitbutton" OnClick="document.forms['valide_settings'].submit();this.blur();" name="Save" class="button-primary"><span> <?php _e('Save options', 'sponsorpress'); ?> </span></a>
                    </li>
                </ul>
                </div> <!-- .postbox -->
            </div>
    
          
            
         </div>
        
        
    </form>
    <br><br>
</div>
